<template>
  <div>
    <particu-home :name="name" :banner="banner" :gallery="gallery"></particu-home> <!--头部 -->
    <rec-home :recom="recom" ></rec-home>
    <tickets-home :ticketList="ticketList"></tickets-home> <!-- 详情页-->
    <comm-home :comments="comments"></comm-home>
  </div>
</template>

<script>
import axios from 'axios'
import ParticuHome from './components/Particu.vue'
import TicketsHome from './components/Tickets.vue'
import CommHome from './components/Comment.vue'
import RecHome from './components/Recommend.vue'
export default {
  name: 'detail',
  components: {
    ParticuHome,
    TicketsHome,
    CommHome,
    RecHome
  },
  data () {
    return {
      name: '',
      banner: '',
      gallery: [],
      ticketList: [],
      comments: [],
      recom: []
    }
  },
  methods: {
    handleSuccess (res) {
      let dataObj = res.data
      if (dataObj.ret && dataObj.data) {
        let dataList = dataObj.data
        this.name = dataList.sightName
        this.banner = dataList.bannnerImg
        this.gallery = dataList.galleryImgs
        this.ticketList = dataList.ticketList
        this.comments = dataList.comments
        this.recom = dataList.recom
      }
    }
  },
  mounted () {
    axios.get('/lcoaldata/par.json', {
      prams: {
        id: this.$route.params.id
      }
    })
      .then((res) => {
        this.handleSuccess(res)
      })
  }
}
</script>

<style lang="stylus" scoped="scoped">
</style>
